<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <title>遛狗服务</title>
    <style>
        :root {
            --primary-color: #FFF9C4;
            --secondary-color: #FFECB3;
            --light-bg: #FFFDE7;
            --text-dark: #5D4037;
            --text-light: #8D6E63;
            --border-color: #FFE082;
            --hover-color: #FFE082;
            --shadow-color: rgba(255, 213, 79, 0.2);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Helvetica Neue', Arial, 'Microsoft YaHei', sans-serif;
        }

        body {
            background-color: var(--light-bg);
            color: var(--text-dark);
        }

        .container {
            max-width: 1200px;
            margin: 20px auto;
            padding: 30px;
            background-color: white;
            border-radius: 16px;
            box-shadow: 0 5px 25px var(--shadow-color);
        }

        h1 {
            color: #FFB300;
            margin-bottom: 30px;
            text-align: center;
            font-weight: 600;
            font-size: 2.2rem;
        }

        .search-bar {
            display: flex;
            margin-bottom: 30px;
            gap: 10px;
        }

        .search-bar input {
            flex: 1;
            padding: 12px 20px;
            border: 1px solid var(--border-color);
            border-radius: 30px;
            font-size: 16px;
        }

        .search-bar button {
            background-color: #FFB300;
            color: white;
            border: none;
            border-radius: 30px;
            padding: 0 25px;
            cursor: pointer;
            transition: background-color 0.3s;
        }

        .search-bar button:hover {
            background-color: #FF8F00;
        }

        .role-switcher {
            display: flex;
            gap: 15px;
            margin-bottom: 30px;
            flex-wrap: wrap;
            justify-content: center;
        }

        .btn {
            padding: 12px 20px;
            background-color: var(--secondary-color);
            border: 1px solid var(--border-color);
            border-radius: 20px;
            text-decoration: none;
            color: var(--text-dark);
            font-weight: 500;
            transition: all 0.3s ease;
        }

        .btn:hover {
            background-color: var(--hover-color);
        }

        .btn.active {
            background-color: var(--hover-color);
            font-weight: bold;
        }

        .service-list {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
            gap: 25px;
            margin-top: 30px;
        }

        .service-card {
            background-color: var(--primary-color);
            border-radius: 12px;
            padding: 20px;
            transition: all 0.3s ease;
            border: 2px solid var(--border-color);
            box-shadow: 0 5px 15px rgba(255, 179, 0, 0.1);
        }

        .service-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(255, 179, 0, 0.2);
            background-color: var(--secondary-color);
            border-color: #FFB300;
        }

        .service-card h3 {
            margin-bottom: 15px;
            color: var(--text-dark);
            font-size: 18px;
            font-weight: 600;
            position: relative;
        }

        .service-card h3::after {
            content: '';
            position: absolute;
            bottom: -5px;
            left: 0;
            width: 40px;
            height: 3px;
            background-color: #FF8F00;
        }

        .service-card p {
            margin: 8px 0;
            color: var(--text-dark);
            line-height: 1.6;
        }

        .service-card strong {
            color: #5D4037;
        }

        .action-btns {
            margin-top: 15px;
            display: flex;
            justify-content: flex-end;
        }

        .action-btn {
            background: linear-gradient(to right, #FFB300, #FF8F00);
            color: white;
            border: none;
            border-radius: 20px;
            padding: 8px 20px;
            cursor: pointer;
            transition: all 0.3s;
            font-weight: 500;
            box-shadow: 0 3px 10px rgba(255, 179, 0, 0.2);
            text-decoration: none;
            display: inline-block;
        }

        .action-btn:hover {
            background: linear-gradient(to right, #FF8F00, #E65100);
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(255, 179, 0, 0.3);
        }
        .action-btns {
            display: flex;
            justify-content: flex-end;
            gap: 10px; /* 添加按钮间距 */
            margin-top: 15px;
        }
    </style>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
</head>
<body>
<jsp:include page="/WEB-INF/views/user/head.jsp"/>
<div class="container">
    <h1>遛狗服务</h1>

    <div class="search-bar">
        <input type="text" placeholder="搜索遛狗服务...">
        <button><i class="fas fa-search"></i> 搜索</button>
    </div>

    <div class="role-switcher">
        <a href="${pageContext.request.contextPath}/dogwalking/list?role=provider" class="btn ${role == 'provider' ? 'active' : ''}">
            <i class="fas fa-hand-holding-heart"></i> 我提供的服务
        </a>
        <!--<a href="${pageContext.request.contextPath}/dogwalking/list?role=requester" class="btn ${role == 'requester' ? 'active' : ''}">
            <i class="fas fa-calendar-check"></i> 我预约的服务
        </a>-->
        <a href="${pageContext.request.contextPath}/dogwalking/list" class="btn ${role == 'browse' ? 'active' : ''}">
            <i class="fas fa-search"></i> 浏览可预约服务
        </a>
        <a href="${pageContext.request.contextPath}/dogwalking/publish" class="btn">
            <i class="fas fa-plus-circle"></i> 发布遛狗服务
        </a>
        <a href="${pageContext.request.contextPath}/dogwalking/orders" class="btn">
            <i class="fas fa-clipboard-list"></i> 我的订单
        </a>
    </div>
    <div class="service-list">
        <c:forEach items="${services}" var="service">
            <div class="service-card">
                <h3>${service.title}</h3>
                <p>${service.description}</p>
                <p><strong>地点:</strong> ${service.location}</p>
                <p><strong>时间:</strong> ${service.date_time}</p>
                <p><strong>时长:</strong> ${service.duration}分钟</p>
                <p><strong>价格:</strong> ¥${service.price}</p>

                <div class="action-btns">
                    <c:if test="${role == 'browse'}">
                        <a href="${pageContext.request.contextPath}/dogwalking/detail/${service.service_id}" class="action-btn">
                            <i class="fas fa-paw"></i> 查看详情
                        </a>
                        <a href="${pageContext.request.contextPath}/dogwalking/book/${service.service_id}" class="action-btn" style="margin-left: 10px;">
                            <i class="fas fa-calendar-plus"></i> 立即预约
                        </a>
                    </c:if>
                </div>
            </div>
        </c:forEach>
    </div>
</div>
</body>
</html>